﻿using KC.Framework.Tenant;
using KC.Service.Core.EFService;
using KC.DTO.Account;
using KC.DTO.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;

namespace KC.Service.Account
{
    public interface ISysManageService : IEFService
    {
        #region Organization

        List<OrganizationDTO> GetAllOrganization();
        List<OrganizationDTO> GetAllOrganizationTrees();
        List<OrganizationDTO> GetOrganizationsWithUsers();
        List<OrganizationDTO> GetOrganizationTreesByIds(List<int> orgIds);
        List<OrganizationDTO> GetOrganizationsTreesByName(string name);
        List<OrganizationDTO> GetOrganizationsWithUsersByUserId(string userId);
        List<OrganizationDTO> GetOrganizationsById(List<int> treeWhere);
        List<int> GetOrganizationsByIdList(List<int> ids);

        List<OrganizationDTO> GetOrganizationsWithUsersByRoleIds(List<string> roleIds);
        List<OrganizationDTO> GetOrgsWithUsersByRoleIdsAndOrgids(List<string> roleIds, List<int> depIds);
        List<OrganizationDTO> GetOrganizationsByIds(List<int> organizationIds);
        List<OrganizationDTO> GetUsersByOrganizationsId(int id);
        List<OrganizationDTO> GetWorkFlowSelectUser();

        PaginatedBaseDTO<OrganizationDTO> GetPaginatedOrganizationsWithUsers(Guid appid, int pageIndex, int pageSize);
        PaginatedBaseDTO<OrganizationDTO> GetPaginatedOrganizationsWithUsersByFilter(Guid appid, List<string> roleIds, string departName, string departCode, string userName, string userCode, string searchKey, int pageIndex, int pageSize);

        OrganizationDTO GetOrganizationByFid(string orgfid);
        OrganizationDTO GetOrganizationById(int id);
        OrganizationDTO GetOrganizationsWithUsersByOrgId(int orgId);



        bool AddOrganization(OrganizationDTO data);
        bool SaveOrganization(OrganizationDTO data);
        bool RemoveOrganization(int id);

        List<UserDTO> GetUsersByOrgId(int id);
        List<UserDTO> GetUsersByOrgIds(List<int> ids);
        List<UserDTO> GetUsersByOrgIdWithoutOrg(int id);
        List<UserDTO> GetUsersByOrgRange(Guid startDeptFid, Guid endDeptFid);

        bool ExistOrganizationName(int id, string name);
        #endregion

        #region UserTracingLogDTO

        PaginatedBaseDTO<UserTracingLogDTO> LoadPaginatedUserTracingLogs(int pageIndex, int pageSize, string name, string order);


        #endregion

        #region 测试TreeNode基类
        List<OrganizationDTO> Test_GetAllTreeNodeWithNestChild();
        OrganizationDTO Test_GetTreeNodeWithNestChildById(int id);
        List<OrganizationDTO> Test_GetTreeNodesWithNestParentAndChildById(int id);
        List<OrganizationDTO> Test_GetTreeNodesWithNestParentAndChildByFilter(string name);
        bool Test_UpdateExtendFields();
        #endregion

        //SeedEntity GetSeedByType(SeedType seedType, int step = 1);
    }
}
